traverse characters of a string